package service

import (
	"context"
	"jk-time/webook/search/domain"
	"jk-time/webook/search/repository"
)

type SyncService interface {
	InputUser(ctx context.Context, msg domain.User) error
	InputArticle(ctx context.Context, msg domain.Article) error
	InputAny(ctx context.Context, idxName, docID, data string) error
	Delete(ctx context.Context, idxName, docID string) error
}

type syncService struct {
	user    repository.UserRepository
	article repository.ArticleRepository
	anyRepo repository.AnyRepository
}

func (s syncService) InputUser(ctx context.Context, msg domain.User) error {
	return s.user.InputUser(ctx, msg)
}
func (s syncService) InputArticle(ctx context.Context, msg domain.Article) error {
	return s.article.InputArticle(ctx, msg)
}
func (s *syncService) InputAny(ctx context.Context, index, docID, data string) error {
	return s.anyRepo.Input(ctx, index, docID, data)
}
func (s *syncService) Delete(ctx context.Context, idxName, docID string) error {
	return s.anyRepo.Delete(ctx, idxName, docID)
}
